Ext.namespace("eddy.ms.CommonMenu");
eddy.ms.CommonMenu = function(config) {
	this.id = arguments[0];
	this.cls = 'menuCls';
	this.iconCls = arguments[1];
	this.title = arguments[2];
	this.resourceId = arguments[3];
	eddy.ms.CommonMenu.superclass.constructor.apply(this, arguments);
};

Ext.extend(eddy.ms.CommonMenu, eddy.ms.CommonWin, {
	init : function(){
        this.launcher = {
            text: this.title,
            iconCls: 'bogus',
            handler: function() {
				return false;
			},
            menu: {
                items:[]
            }
        }
    },
    
    addMenuItem: function(menuItem) {
    	var aItem = {
    		id: menuItem.id,
	        text: menuItem.title,
	        title: menuItem.title,
	        iconCls: menuItem.iconCls,
	        cls: 'menuCls',
	        url: menuItem.url,
	        createWindow: menuItem.createWindow,
	        handler : menuItem.createWindow
    	};
    	
    	this.launcher.menu.items.push(aItem);
    },
    
    addMenu: function(menu) {
    	var amenu = {
    		id: menu.id,
	        text: menu.title,
	        title: menu.title,
	        iconCls: menu.iconCls,
	        cls: 'menuCls',
	        url: menu.url,
	        handler: function() {
				return false;
			},
            menu: {
                items:[menu.launcher.menu.items]
            }
//	        scope: this
    	};
    	this.launcher.menu.items.push(amenu);
    }
});
